import { sendRequest } from '@/http';

const baseUrl = '/admin/rp';

/**
 * 查询员工角色列表
 * @param params
 * @returns
 */
export const queryStaffRoles = (staffId: string) => {
  return sendRequest({
    url: `${baseUrl}/staffRoles`,
    method: 'get',
    params: { staffId },
  });
};

/**
 * 获取所有角色
 * @returns
 */
export const queryRoles = () => {
  return sendRequest({
    url: `${baseUrl}/roles`,
    method: 'get',
  });
};

/**
 * 给员工设置权限
 * @param staffId 员工ID
 * @param roleIds 角色ID列表
 * @returns
 */
export const giveStaffPermissions = (staffId: string, roleIds: number[]) => {
  return sendRequest({
    url: `${baseUrl}/giveStaffPermissions`,
    method: 'post',
    data: { staffId, roleIds },
  });
};
